#include "main/utils.h"
using namespace std;

class MyCalendar {
  public:
    bool book(int start, int end) {
      auto it = booked.lower_bound({end, 0});
      if (it == booked.begin() || (--it)->second <= start) {
        booked.emplace(start, end);
        return true;
      }
      return false;
    }
  private:
    set<pair<int, int>> booked;
};

int main() {
  MyCalendar my_calendar;
  cout << my_calendar.book(10, 20) << endl;
  cout << my_calendar.book(15, 25) << endl;
  cout << my_calendar.book(20, 30) << endl;
  return 0;
}
